[SOLVED] after # slackpkg upgrade-all upgrades kernel, making a new initramfs is necessary, but not automatic, right?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
After the 'slackpkg upgrade-all' I did get this warning, which was nice:
Code:
Your kernel image was updated, and lilo does not appear to be used on
your system. You may need to adjust your boot manager (like GRUB) to
boot the appropriate kernel (after generating an initrd if required).
Press the "Enter" key to continue...
It updated my kernel from 5.15.19 to 5.15.27 but I use ELILO and the EFI System Partition isn't in the fstab nor mounted automatically, and so ELILO was using the wrong kernel next boot.
But, I couldn't mount the ESP at that moment after the upgrade:
Code:
bash-5.1# mount -t vfat /dev/sdb2 /boot/efi
mount: /boot/efi: unknown filesystem type 'vfat'
I had to use a USB pen drive with GRUB to boot the new kernel in /boot because in the ESP, it had the old. Then I used /usr/share/mkinitrd/mkinitrd_command_generator.sh to suggest a mkinitrd command line, which I used to build a new initrd.gz, mounted the ESP under /boot/efi, and copied the new initrd.gz over the old one in the ESP, and copied the new vmlinuz-generic-5.15.27 to the ESP renaming it to vmlinuz since that is what the elilo.conf is using for the name.
Is this pretty much the routine, or is there a way to automate this? I guess before I run slackpkg upgrade-all next time, I could have a script ready to do everything, like mount the ESP under /boot/efi, make the initrd.gz, and copy the files.
I'm using LVM and the filesystems are ext4.
I guess, in a way this is really a limitation of UEFI only being able to use FAT32, etc. filesystems. Stupid UEFI, lol.
Sounds like a limitation of not keeping kernels and initrds in a native filesystem, either on the root filesystem in the /boot directory, or on a native filesystem mounted to /boot/. Most distros mount the ESP on /boot/efi/, and put no kernels there. My Slackware kernels are also in the root filesystem in /boot/.
Had the ESP been mounted when the initrd was generated, I would expect vfat support would have been included in the new initrd.
Yes, that caught me out once. After you upgrade the kernel-modules package the FAT filesystem driver is no longer present, so if you've not already loaded it into the kernel you will no longer be able to access FAT partitions.
Workaround is to make sure you mount your efi partition before you run upgrade against a kernel-modules packages.
The other, safer, option is to always update your kernel packages with installpkg rather than upgradepkg/upgrade-all, and then removepkg the old ones after you've booted into the new kernel. This is why some folks prefer to blacklist the kernel packages in slackpkg and handle them manually.
I guess, in a way this is really a limitation of UEFI only being able to use FAT32, etc. filesystems. Stupid UEFI, lol.
Quite the opposite, this was a very wise decision from the writers of the specification. This allows the developers of EFI applications, including but not limited to OS loaders, to follow only one well known specification to write their code, thus drastically reducing the amount of work to do.
Last edited by Didier Spaier; 03-20-2022 at 05:22 AM.
The other, safer, option is to always update your kernel packages with installpkg rather than upgradepkg/upgrade-all, and then removepkg the old ones after you've booted into the new kernel. This is why some folks prefer to blacklist the kernel packages in slackpkg and handle them manually.
To quote the Mandalorian: “This Is The Way”
I install multiple kernels & change the kernel naming convention used by Slackware in the ESP.
For new kernels I use installpkg along with blacklisting kernel-generic, huge, modules & source in slackpkg. To generate the new initrd file I use /etc/mkinitrd.conf with: "KRNL="5.16.16" mkinitrd -F -k $KRNL -o /boot/initrd-$KRNL.gz"
Next mount the ESP & copy the newly installed kernel files to the ESP. Finish by modifying elilo.conf for the new kernels.
If you want to keep 2 kernel versions, remove the kernel versions older than those 2 & the associated ESP files & reboot.
Thanks to all of you friendly and helpful gurus on LinuxQuestions.org!
@mrmazda
Others may correct me if I'm wrong, but I think with ELILO the kernel needs to be in the ESP (EFI System Partition) for booting, and not in the /boot directory. This morning I tried adding another image stanza to my elilo.conf, but it couldn't boot it at all:
The page here seems to confirm this in the section UEFI and ELILO.
Unless it is because I'm using LVM? The LVM and Slackware are on /dev/sda while Windows Server and the ESP live on /dev/sdb, and I use F12 at boot to pick Windows on occasion.
Got it, I can mount the ESP before upgrade, or blacklist and use installpkg. I think I will do the later.
@Didier Spaier
That's true, and also the FAT specification was released by Microsoft to the public.
@Chuck56
Thanks so much for your detailed real world config file examples.
I would be inclined to use /etc/mkinitrd.conf but I have not yet read all about that script yet, as I should. I shall do so, but the '/usr/share/mkinitrd/mkinitrd_command_generator.sh' worked for me. Here is the output:
I do really appreciate the scripts provided by the Slackware team! But also I do want to learn to edit my own mkinitrd.conf. The '/usr/share/mkinitrd/mkinitrd_command_generator.sh' says it takes into account LVM, which is nice:
Code:
root@ace:~# head -n 35 /usr/share/mkinitrd/mkinitrd_command_generator.sh
#!/bin/sh
# $Id: mkinitrd_command_generator.sh,v 1.45 2011/02/17 09:27:05 eha Exp eha $
# Copyright 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA
# Copyright 2008, 2009, 2010, 2011 Eric Hameleers, Eindhoven, Netherlands
# Contact: <alien@slackware.com>
# Copyright 2008, 2009 PiterPUNK, Sao Paulo, SP, Brazil
# Contact: <piterpunk@slackware.com>
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# -----------------------------------------------------------------------------
#
# Create an initrd which fits the system.
# Take into account the use of LVM/LUKS/RAID.
# Find out about any hardware drivers the system may need in an initrd when
# booting from a generic lightweight kernel.
#
# -----------------------------------------------------------------------------
Output is the same whether or not I had the ESP mounted when running it.
Is there anything else to add to the mkintrd.conf for LVM?
Great, Chuck56 that you have it scripted! Do you run it as a cron job so you don't have to do anything at all manually?
I would say my question is "solved" but additional comments are always welcome.
I would be inclined to use /etc/mkinitrd.conf but I have not yet read all about that script yet, as I should. I shall do so, but the '/usr/share/mkinitrd/mkinitrd_command_generator.sh' worked for me.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.